<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateNoteDrawItemsTable extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     */
    public function change()
    {
        $table = $this->table('note_draw_items', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_unicode_ci']);
        $table->addColumn('draw_id', 'integer', ['null' => false, 'comment' => '抽取记录ID'])
            ->addColumn('note_id', 'integer', ['null' => false, 'comment' => '纸条ID'])
            ->addColumn('create_time', 'timestamp', ['null' => true, 'comment' => '创建时间'])
            ->addIndex(['draw_id'])
            ->addIndex(['note_id'])
            ->create();
    }
} 